import {PureComponent} from "react";
import {NavLink, Outlet} from "react-router-dom";
import WithRouter from "../../hoc/withRouter";

class Home extends PureComponent {
    render() {
        const {router: {navigate}} = this.props;
        return (
            <div>
                <h1>home组件</h1>
                <nav>
                    <NavLink to={"/home/recommend"}>推荐</NavLink>
                    <NavLink to={"/home/ranking"}>排行榜</NavLink>
                    <button onClick={() => navigate('/home/song')}>歌单</button>
                </nav>
                {/*占位符 相当于router-view,告知子路由在哪渲染*/}
                <Outlet/>
            </div>
        )
    }
}

export default WithRouter(Home);